/**
 * Created with IntelliJ IDEA.
 * Description:
 * https://gitee.com/li--jiaqiang/java-test.git
 * git pull
 * git pull origin master
 * git pull origin master --allow-unrelated-histories
 * User: 86187
 * Date: 2022-05-03
 * Time: 10:14
 */

//Scanner scan = new Scanner(System.in);

import java.util.Scanner;

public class TestDemo {

    /**
     * 递归求斐波那契数列
     * @param n
     * @return
     */
    public static int fibonacci(int n) {
        int f1 = 1;
        int f2 = 1;
        int ans = 1;
        for (int i = 3; i <= n; i++) {
            ans = f1 + f2;
            f1 = f2;
            f2 = ans;
        }
        return ans;
    }

    public static void main(String[] args) {

        System.out.println(fibonacci(4));

    }
}
